package co.th.helper.jdbc.mapper;

import java.sql.ResultSet;
import java.sql.SQLException;

import co.th.helper.jdbc.RowMapper;
import co.th.helper.model.Brand;

public class BrandRowMapper extends RowMapper<Brand>{

	@Override
	public Brand mapRow(ResultSet resultSet) throws SQLException {
		Brand brand = new Brand();
		if (isThere(resultSet, "brand_code"))
			brand.setBrandCode(resultSet.getBigDecimal("brand_code"));
		if (isThere(resultSet, "brand_name_th"))
			brand.setBrandNameTh(resultSet.getString("brand_name_th"));
		if (isThere(resultSet, "brand_name_en"))
			brand.setBrandNameEn(resultSet.getString("brand_name_en"));
		if (isThere(resultSet, "create_by"))
			brand.setCreateBy(resultSet.getString("create_by"));
		if (isThere(resultSet, "create_date"))
			brand.setCreateDate(resultSet.getDate("create_date"));
		if (isThere(resultSet, "update_by"))
			brand.setUpdateBy(resultSet.getString("update_by"));
		if (isThere(resultSet, "update_date"))
			brand.setUpdateDate(resultSet.getDate("update_date"));
		return brand;
	}

}
